package com.apes.scm.rbac.repository;


import com.apes.framework.jpa.repository.CustomRepository;
import com.apes.scm.rbac.model.Role;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Date;
import java.util.List;

public interface RoleRepository extends CustomRepository<Role, String> {

    @Query("select T from Role T where lastUpdatedStamp > :times or (id > :id and lastUpdatedStamp = :times) order by lastUpdatedStamp, id asc ")
    List<Role> findByLastUpdatedStampAndId(@Param("times") Date times, @Param("id") String id, Pageable pageable);
}
